import { defineStore } from 'pinia'
import LocalStorage from '@/utils/localstorage'

export const useGlobalStore = defineStore('global', {
    state: () => {
        return {
            user: {
            },
            upgrade: {
                ver: '',
                url: '',
                type: 0,//升级方式
                time: 0,
                desc: []
            },
            device_token: '',
            client_id: '',
            version: ''
        }
    },
    getters: {
    },
    actions: {
        getUser() {
            return this.user
        },
        setUser(data = '') {
            if (!data) {
                LocalStorage.removeToken()
            }
            this.user = data || {}
        }
    }
});